/**
 * Created by Mr.no.
 * User:yangyun
 * Date:2017/4/13
 * Time:18:23
 */


import java.io.FileNotFoundException;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.Scanner;

/**
 * 对于一个给定的井字棋棋盘，请设计一个高效算法判断当前玩家是否获胜。
 *给定一个二维数组board，代表当前棋盘，其中元素为1的代表是当前玩家的
 *棋子，为0表示没有棋子，为-1代表是对方玩家的棋子。
 *测试样例：
 *[[1,0,1],[1,-1,-1],[1,-1,0]]
 *返回：true
 */
public class Board {
   public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {
//    String num="hello";
//    String num1=num.substring(0,3)+"p!";
//    System.out.println(num1);

//    int num2=num1.length();
//    System.out.println(num2);
//    String num3=String.join("/","mom","dad","i");
//       System.out.println(num3);

//       String num1="hello";
//       String num2="Hello";
//       System.out.println(  num1.equals(num2));
//      System.out.println( num1.equalsIgnoreCase(num2));
//      int n=num1.length();
//       System.out.println(n);
//       int copycodecount=num1.codePointCount(0,n);
//       System.out.println(copycodecount);
//       System.out.println(num1.charAt(0));
//       System.out.println(num1.offsetByCodePoints(0,copycodecount));
//       StringBuilder stringBuilder=new StringBuilder();
//       String num="hello";
//       String num1="nihao";
//       stringBuilder.append(num);
//       stringBuilder.append(num1);
//       System.out.println(stringBuilder);
//       Scanner scanner=new Scanner(System.in);
//       String sc=scanner.nextLine();
//       System.out.println(sc);
//       System.out.printf("%,.2f",10000.0/3.0);
//       System.out.printf("%tc",new Date());
//       PrintWriter out =new PrintWriter("a.txt","UTF-8");
//       Scanner canner =new Scanner(System.in);
//       String sc=canner.nextLine();
//       while(canner.hasNext()){
//           System.out.println("yang");
//       }
//       System.out.println("how much money will contribute every year");
//       double payment=canner.nextDouble();
//
//       System.out.println("interest rate in %：");
//       double interestrate=canner.nextDouble();
//
//       double balance=0;
//       int year=0;
//
//       String input;
//
//       do {
//           balance +=payment;
//           double interest=balance*interestrate/100;
//           balance +=interest;
//
//           year++;
//
//           System.out.printf("after year %d,your balance is %,.2f%n",year,balance);
//
//           System.out.print("Ready to retire?(Y/N)");
//           input=canner.next();
//
//       }while(input.equals("N"));
//
       Scanner canner =new Scanner(System.in);

       System.out.println("how many numbers do you need to draw?");
       int k=canner.nextInt();

       System.out.println("what is the highest number you can draw?");
       int n=canner.nextInt();
/**
 * 方法一
 * 利用常规方法
 */
//       int lotteryOdds=1;
//       for (int i=1;i<=k;i++) {
//           lotteryOdds = lotteryOdds * (n - i + 1) / i;
//       }
       /**
        * 方法二
        * 利用大数值进行运算
        */
//       BigInteger lotteryOdds=BigInteger.valueOf(1);
//
//       for (int i=1;i<=k;i++){
//           lotteryOdds=lotteryOdds.multiply(BigInteger.valueOf(n-i+1)).divide(BigInteger.valueOf(i));
//
//       }
        int [] numbers=new int[n];
        for (int i=0;i<numbers.length;i++){
            numbers[i]=i+1;
        }

        int [] result=new int [k];
       for (int i=0;i<result.length;i++){
           int r=(int)(Math.random()*n);
           result[i]=numbers[r];
           numbers[r]=numbers[n-1];
           n--;
       }

       Arrays.sort(result);
       for (int r:result){
           System.out.println(r);
       }
       // System.out.println("your odds are 1 in"+lotteryOdds+"good luck!");

   }
}
